/**
 * 
 */
package com.thoughtworks.merchantsguide.converter;

import org.apache.commons.lang.StringUtils;

import com.thoughtworks.merchantsguide.cache.ComodityPriceCache;
import com.thoughtworks.merchantsguide.exception.UnsupportedNumberException;

/**
 * @author prakash
 *
 */
public class GalicticToRomanConverter {

	/**
	 * This method gives roman number equivalent of galactic words. Only
	 * supported galactic words in the input can be converted to roman numbers.
	 * 
	 * @param iGalacticLiteralsForWords
	 * @return
	 * @throws UnsupportedNumberException
	 */
	public String convert(String iGalacticLiteralsForWords) throws UnsupportedNumberException {
		StringBuilder romanNumber = new StringBuilder();
		for (String eachWord : StringUtils.split(iGalacticLiteralsForWords)) {
			romanNumber.append(ComodityPriceCache.getRomanEquivalentForGalactic(eachWord));
		}
		return romanNumber.toString();
	}

}
